package models.system;

import models.UUIDModel;
import models.constants.Gender;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

/**
 * 系统管理员
 */
@Entity
@Table(name = "ss_admin_users")
public class TempAdminUser extends UUIDModel {

    /**
     * 用户名
     */
    @Column(name = "user_name", length = 30)
    public String userName;

    /**
     * 真实姓名
     */
    @Column(name="real_name", length = 10)
    public String realName;

    /**
     * 登录密码
     */
    @Column(name="password", length = 32)
    public String password;

    /**
     * 所属机构
     */
    @JoinColumn(name = "organization")
    @ManyToOne
    public Company organization;

    /**
     * 性别 0 男, 1 女, 2 未知
     */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "gender")
    public Gender gender;

    /**
     * 年龄
     */
    @Column(name="age")
    public Integer age;

    /**
     * 联系电话
     */
    @Column(name="phone", length = 15)
    public String phone;

    /**
     * 备注信息
     */
    @Column(name="remark", length = 100)
    public String remark;

    /**
     * 创建人
     */
    @JoinColumn(name = "creator")
    @ManyToOne
    public TempAdminUser creator;

    /**
     * 最后修改时间
     */
    @Column(name="modify_at")
    public Date modifyAt;

    /**
     * 最后修改人
     */
    @JoinColumn(name = "modify_id")
    @ManyToOne
    public TempAdminUser modifyId;

    /**
     * 上次登录时间
     */
    @Column(name="last_login_time")
    public Date lastLoginTime;

}
